/**
 * 公司设置的接口
 */
import request from "@/utils/request";

/**
 * 获取所有角色列表
 */
const getRoleList = params => request({
  url: '/sys/role',
  // method: 'GET',
  params
})

/**
 * 根据id查询企业
 */
const getCompanyInfo = id => request({
  url: `/company/${id}`,
  // method: 'GET',
})

/**
 * 根据ID删除角色
 */
const deleteRole = id => request({
  url: `/sys/role/${id}`,
  method: 'DELETE'
})

/**
 * 根据ID更新角色
 */
const updateRole = data => request({
  url: `/sys/role/${data.id}`,
  method: 'PUT',
  data
})

/**
 * 根据ID获取角色详情
 */
const getRoleDetail = id => request({
  url: `/sys/role/${id}`,
})

/**
 * 添加角色
 */
const addRole = data => request({
  url: `/sys/role`,
  method: 'POST',
  data
})

/**
 * 给员工分配角色
 */
const assignPerm = data => request({
  url: '/sys/role/assignPrem',
  method: 'PUT',
  data
})


export {
  getRoleList,
  getCompanyInfo,
  deleteRole,
  updateRole,
  getRoleDetail,
  addRole,
  assignPerm
}